<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>取得 getimagesize，exif_read_data，exif_thumbnail，exif_imagetype
    所返回的图像类型的 MIME 类型</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.image-type-to-extension.html">image_type_to_extension</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.image2wbmp.html">image2wbmp</a></div>
 <div class="up"><a href="ref.image.html">GD and Image 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.image-type-to-mime-type" class="refentry">
  <div class="refnamediv">
   <h1 class="refname">image_type_to_mime_type</h1>
   <p class="verinfo">(PHP 4 &gt;= 4.3.0, PHP 5)</p><p class="refpurpose"><span class="refname">image_type_to_mime_type</span> &mdash; <span class="dc-title">取得 getimagesize，exif_read_data，exif_thumbnail，exif_imagetype
    所返回的图像类型的 MIME 类型</span></p>

  </div>
  <div class="refsect1 unknown-notet" id="refsect1-function.image-type-to-mime-type-unknown-notet">
   <h3 class="title">说明</h3>
   <div class="methodsynopsis dc-description">
    <span class="type">string</span> <span class="methodname"><strong>image_type_to_mime_type</strong></span>
     ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$imagetype</code></span>
    )</div>

   <p class="para rdfs-comment">
    <span class="function"><strong>image_type_to_mime_type()</strong></span> 函数可以判断一个 IMAGETYPE
    常量的 MIME 类型。
    <div class="example" id="example-3115">
     <p><strong>Example #1 image_type_to_mime_type (file)</strong></p>
     <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />header</span><span style="color: #007700">(</span><span style="color: #DD0000">"Content-type:&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">image_type_to_mime_type</span><span style="color: #007700">(</span><span style="color: #0000BB">IMAGETYPE_PNG</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
     </div>

    </div>
   </p>
   <p class="para">
    返回值如下：
    <table class="doctable table">
    <caption><strong>返回值常量</strong></caption>
     
      <thead>
       <tr>
        <th>图像类型（<em><code class="parameter">imagetype</code></em>）</th>
        <th>返回值</th>
       </tr>

      </thead>

      <tbody class="tbody">
       <tr>
        <td><strong><code>IMAGETYPE_GIF</code></strong></td>
        <td><em>image/gif</em></td>
       </tr>

       <tr>
        <td><strong><code>IMAGETYPE_JPEG</code></strong></td>
        <td><em>image/jpeg</em></td>
       </tr>

       <tr>
        <td><strong><code>IMAGETYPE_PNG</code></strong></td>
        <td><em>image/png</em></td>
       </tr>

       <tr>
        <td><strong><code>IMAGETYPE_SWF</code></strong></td>
        <td><em>application/x-shockwave-flash</em></td>
       </tr>

       <tr>
        <td><strong><code>IMAGETYPE_PSD</code></strong></td>
        <td><em>image/psd</em></td>
       </tr>

       <tr>
        <td><strong><code>IMAGETYPE_BMP</code></strong></td>
        <td><em>image/bmp</em></td>
       </tr>

       <tr>
        <td><strong><code>IMAGETYPE_TIFF_II</code></strong> (intel byte order)</td>
        <td><em>image/tiff</em></td>
       </tr>

       <tr>
        <td>
         <strong><code>IMAGETYPE_TIFF_MM</code></strong> (motorola byte order)
        </td>
        <td><em>image/tiff</em></td>
       </tr>

       <tr>
        <td><strong><code>IMAGETYPE_JPC</code></strong></td>
        <td><em>application/octet-stream</em></td>
       </tr>

       <tr>
        <td><strong><code>IMAGETYPE_JP2</code></strong></td>
        <td><em>image/jp2</em></td>
       </tr>

       <tr>
        <td><strong><code>IMAGETYPE_JPX</code></strong></td>
        <td><em>application/octet-stream</em></td>
       </tr>

       <tr>
        <td><strong><code>IMAGETYPE_JB2</code></strong></td>
        <td><em>application/octet-stream</em></td>
       </tr>

       <tr>
        <td><strong><code>IMAGETYPE_SWC</code></strong></td>
        <td><em>application/x-shockwave-flash</em></td>
       </tr>

       <tr>
        <td><strong><code>IMAGETYPE_IFF</code></strong></td>
        <td><em>image/iff</em></td>
       </tr>

       <tr>
        <td><strong><code>IMAGETYPE_WBMP</code></strong></td>
        <td><em>image/vnd.wap.wbmp</em></td>
       </tr>

       <tr>
        <td><strong><code>IMAGETYPE_XBM</code></strong></td>
        <td><em>image/xbm</em></td>
       </tr>

      </tbody>
     
    </table>

   </p>
   <p class="para">
    <blockquote class="note"><p><strong class="note">Note</strong>: 
     <span class="simpara">
      本函数不需要 GD 库。
     </span>
    </p></blockquote>
   </p>
   <p class="para">
    参见 <span class="function"><a href="function.getimagesize.html" class="function">getimagesize()</a></span>，<span class="function"><a href="function.exif-imagetype.html" class="function">exif_imagetype()</a></span>，<span class="function"><a href="function.exif-read-data.html" class="function">exif_read_data()</a></span>
    和 <span class="function"><a href="function.exif-thumbnail.html" class="function">exif_thumbnail()</a></span>。
   </p>
  </div>

 </div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.image-type-to-extension.html">image_type_to_extension</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.image2wbmp.html">image2wbmp</a></div>
 <div class="up"><a href="ref.image.html">GD and Image 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
